package com.st.service.impl;

import com.st.dao.IOrderDao;
import com.st.dao.IOrderGoodsDao;
import com.st.entity.Order;
import com.st.entity.OrderGoods;
import com.st.service.IOrderService;
import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class OrderService implements IOrderService {
    @Autowired
    private IOrderDao orderDao;
    @Autowired
    private IOrderGoodsDao orderGoodsDao;
    @Override
    public List<Order> query(Order order) {
        return orderDao.query(order);
    }

    @Override
    public List<OrderGoods> list(String orderNo) {
        return orderGoodsDao.query(orderNo);
    }
    @Override
    public Integer goodsDown(String ids) {
        Map<String, String> map = new HashMap<>();
        map.put("orderStatus", "3");
        map.put("ids", ids);
        return orderDao.updateStatus(map);
    }

    @Override
    public Integer goodsrefund(String ids) {
        Map<String, String> map = new HashMap<>();
        map.put("orderStatus", "5");
        map.put("ids", ids);
        return orderDao.updateStatus(map);
    }
    @Override
    public Integer goodstuikuanchenggong(String ids) {
        Map<String, String> map = new HashMap<>();
        map.put("orderStatus", "6");
        map.put("ids", ids);
        return orderDao.updateStatus(map);
    }

    @Override
    public Integer add(Order order) {
        return orderDao.add(order);
    }

    @Override
    public List<OrderGoods> queryMyOrder(OrderGoods orderGoods) {
        return orderGoodsDao.queryMyOrder(orderGoods);
    }

    @Override
    public Integer del(String orderNo) {
        return orderGoodsDao.del(orderNo);
    }

    @Override
    public Integer delOrder(String orderNo) {
        return orderDao.delOrder(orderNo);
    }
}
